a11y: Add utility function for null refs
authorEmmanuele Bassi <ebassi@gnome.org>
Sat, 10 Oct 2020 11:51:03 +0000 (12:51 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 12 Oct 2020 15:19:32 +0000 (16:19 +0100)
ATSPI was written for CORBA, which allows passing around "nil"
as valid object references.

gtk/a11y/gtkatspicontext.c
gtk/a11y/gtkatspiutils.c
gtk/a11y/gtkatspiutilsprivate.h

index b93373db5cf5c7218b2fbd383efbc246dbad097e..c1448b6e22b2b87f4a7093f79bf8ead5420dab9c 100644 (file)
@@ -426,7 +426,7 @@ handle_accessible_get_property (GDBusConnection       *connection,
         }
 
       if (res == NULL)
-        res = g_variant_new ("(so)", "", "/org/a11y/atspi/null");
+        res = gtk_at_spi_null_ref ();
     }
   else if (g_strcmp0 (property_name, "ChildCount") == 0)
     {
index 4233904bb590ec895d3282b0c0d3fbdf5ee415ab..7a572ee41f0a8eff1adb16a75600ae933cbd4be8 100644 (file)
@@ -275,3 +275,9 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
 
   return GTK_ACCESSIBLE_ROLE_WIDGET;
 }
+
+GVariant *
+gtk_at_spi_null_ref (void)
+{
+  return g_variant_new ("(so)", "", "/org/a11y/atspi/null");
+}
index b882585a015937a41f3aa940ba9aa4569e86b531..6d4f6610267968fc3fa61fbbee42528dbb8d2fc7 100644 (file)
@@ -26,4 +26,7 @@ G_BEGIN_DECLS
 AtspiRole
 gtk_accessible_role_to_atspi_role (GtkAccessibleRole role);
 
+GVariant *
+gtk_at_spi_null_ref (void);
+
 G_END_DECLS